#include <gtest/gtest.h>

#include <vector>

#include "algorithm/greedy/include/jump.h"
#include "algorithm/greedy/include/maximumBags.h"
using namespace std;
TEST(TestMinJump, GreedySuits) {
    std::vector<int> a = {2, 3, 1, 1, 4};
    std::vector<int> a1 = {0};
    std::vector<int> a2 = {1, 2, 3};
    std::vector<int> a3 = {3, 2, 1};
    EXPECT_EQ(jump(a), 2);
    EXPECT_EQ(jump(a1), 0);
    EXPECT_EQ(jump(a2), 2);
    EXPECT_EQ(jump(a3), 1);
    a = {1, 2, 1, 1, 1};
    EXPECT_EQ(jump(a), 3);
}

TEST(TestMaximumBags, CommonSuits) {
    vector<int> capacity = {2, 3, 4, 5};
    vector<int> rocks = {1, 2, 4, 4};
    int additionalRocks = 2;
    EXPECT_EQ(maximumBags(capacity, rocks, additionalRocks), 3);
}

TEST(TestCanReach, CommonSuits) {
    vector<int> nums = {4, 2, 3, 0, 3, 1, 2};
    EXPECT_TRUE(canReach(nums, 5));
    nums = {3, 0, 2, 1, 2};
    EXPECT_FALSE(canReach(nums, 2));
}

TEST(TestMaxResult, CommonSuits) {
    vector<int> nums = {1, -1, -2, 4, -7, 3};
    EXPECT_EQ(maxResult(nums, 2), 7);
    nums = {10, -5, -2, 4, 0, 3};
    EXPECT_EQ(maxResult(nums, 3), 17);
    nums = {1, -5, -20, 4, -1, 3, -6, -3};
    EXPECT_EQ(maxResult(nums, 2), 0);
}
